﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XH.BMS.Base;
using XH.BMS.Models;

namespace XH.BMS.ViewModels
{
    public class AlarmViewModel : NotifyBase
    {
        public DateTime StartDT { get; set; }
        public DateTime EndDT { get; set; }
        public ObservableCollection<AlarmItemModel> AlarmList { get; set; } = new ObservableCollection<AlarmItemModel>();
        public AlarmViewModel()
        {
            EndDT = DateTime.Now;
            StartDT = EndDT.AddDays(-7);

            AlarmList = new ObservableCollection<AlarmItemModel>();

            for (int i = 0; i < 30; i++)
            {
                AlarmList.Add(new AlarmItemModel()
                {
                    Index = i + 1,
                    Title = $"#{(i + 1).ToString().PadLeft(3, '0')}号电芯报警消息",
                    Description = "详情说明",
                    Date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
                    AlarmType = "一般"
                });
            }

        }

        private void Refresh()
        {
            // 从数据库获取相关
            AlarmList.Clear();
            for (int i = 0; i < 30; i++)
            {
                AlarmList.Add(new AlarmItemModel()
                {
                    Index = i + 1,
                    Title = $"#{(i + 1).ToString().PadLeft(3, '0')}号电芯报警消息",
                    Description = "详情说明",
                    Date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
                    AlarmType = "一般"
                });
            }
        }
    }
}
